function trim(val)
{
	 return val.replace(/(^\s*)|(\s*$)/g, "");  
}

function checkSub(){
	if(document.getElementById('order_no').value==''){
		alert('');
		document.getElementById('order_no').focus();
		return false;
	}
	
	if(document.getElementById('num').value==''){
		alert('请输入订购数量！');
		document.getElementById('num').focus();
		return false;
	}
	
	if(document.getElementById('price').value==''){
		alert('请输入价格');
		document.getElementById('price').focus();
		return false;
	}
	if(document.getElementById('total_price').value==''){
		alert('请输入总价');
		document.getElementById('total_price').focus();
		return false;
	}
	if(trim(document.getElementById('cellphone').value)=='')
  {
      alert('请输入手机号码！');
	  document.getElementById('cellphone').focus();
      return; 
  } else {
	var mobileReg = /^(((13[0-9]|18[0-9]|15[0-9]{1}))+\d{8})$/; 
	if(!mobileReg.test(trim(document.getElementById('cellphone').value))){
      alert('请输入有效的手机号码！');
	  document.getElementById('cellphone').focus();
      return;
	}
  }
	
	
	    var area_attr = document.getElementById('area_attr').value;
		if(document.getElementById('province').value != ''){
		var area_attr = '';
		area_attr += document.getElementById('province').value+'|';
		if(document.getElementById('eparchy_code').value!=''){
			area_attr += document.getElementById('eparchy_code').value+'|';
			if(document.getElementById('city_code').value!=''){
				area_attr += document.getElementById('city_code').value+'|';
			}
		 }
		}
		if(area_attr == ''){
			alert('请选择国家或地区！');
			return false;
		}
		document.getElementById('area_attr').value = area_attr;
	 
	
	
	
	document.addForm.submit();
}

function search(){
	//TODO
	document.indexForm.submit();
}
function ChangeAreaStyle(){
	document.getElementById("area_attr").value = '';
	document.getElementById("areaId1").style.display = 'none';
	document.getElementById("areaId2").style.display = 'block';
}

function countprice(){
	var price=document.getElementById("price").value;
	var num=document.getElementById("num").value;
	var total_price='';
	total_price=price*num;
	document.getElementById("total_price").value=total_price;
}